/*! 20230430-1-RELEASE */

!function(){const t={ctaAnchorWidth:100,ctaAnchorMarginRight:2,ctaAnchorMarginLeft:2},e=72,a=4,n=2,i=8,r="10px",o=.1,s=10,l=.98,d=TRC.dom.createHTMLElement("canvas");class c{constructor(t,e){this.itemContainer=t,this.rbox=t.rbox,this.ctaData=e,this.labelsBox=t.labelsBox,c.styleInjected||c.injectCallToActionStyle()}static injectCallToActionStyle(){const e=`${t.ctaAnchorWidth}px`,a=`${t.ctaAnchorMarginRight}px`,n=`${t.ctaAnchorMarginLeft}px`;TRC.dom.injectStyle(`div.videoCube a.video-cta-style { width: 100%; } div.videoCube a.video-cta-style span.video-label-box.video-label-box-cta { display: flex; flex-wrap: wrap; align-content: flex-start; } div.videoCube a.video-cta-style span.video-label-box.video-label-box-cta.video-label-box-cta-non-ie { justify-content: space-between; } div.videoCube a.video-cta-style span.video-label-box.video-label-box-cta.app-install-full-grid.app-install-full-grid { align-items: center; align-content: center; display: grid; grid-template-columns: 8fr 2fr; min-width: 100%; width: 100%; min-height: 100%; height: 100%; padding: 0; margin: 0 0 8px; direction: inherit; } div.videoCube a.video-cta-style span.video-label-flex-cta-item { flex-basis: 100%; } div.videoCube a.video-cta-style span.video-branding-flex-cta-item { flex-grow: 1; flex-basis: 1px; } div.videoCube a.video-cta-style .video-branding-flex-cta-item-no-stream { margin-top: 5px; } div.videoCube a.video-cta-style .app-install-full-grid .video-branding-flex-cta-item-no-stream { padding: 0; border: 0; margin: 0; display: flex; height: 100%; min-height: 100%; direction: inherit; } div.videoCube a.video-cta-style .app-install-full-grid .video-branding-flex-cta-item-no-stream::after { display: none; } div.videoCube a.video-cta-style a.video-cta-href { display: inline-block; margin: 5px 2px 0px 2px; padding: 0; min-width: 72px; bottom: 0; vertical-align: top; position: relative; box-sizing: content-box; align-self: start; order: 2; flex-shrink: 0; font-size: 10px; line-height: 13.2px; } div.videoCube a.video-cta-style a.video-cta-href.app-install-size { min-width: 65px; max-height: 36px; min-height: 36px; height: 36px; margin: 0; } div.videoCube a.video-cta-style a.video-cta-href button.video-cta-button { margin: 0; height: 24px; font-size: 10px; line-height: 13.2px; border-radius: 4px; border: 1px solid; background-color: inherit; border-color: #999999; text-transform: none; letter-spacing: normal; box-sizing: border-box; font-weight: 400; cursor: pointer; outline: none; font-family: Helvetica; padding: 1px 4px; width: 100%; min-width: 1px; opacity: 1; box-shadow: none; user-select: none; transition: none; text-decoration: none; transform: none; } div.videoCube a.video-cta-style a.video-cta-href button.video-cta-button.app-install-button { min-height: 100%; height: 100%; } div.videoCube a.video-cta-style a.video-cta-href button.video-cta-button:hover { color: inherit; border-color: inherit; background-color: inherit; letter-spacing: normal; }div.videoCube a.video-cta-style.non-feed-cta-item span.video-branding-flex-cta-item-no-stream { margin-top: 3px; }div.videoCube a.video-cta-style.non-feed-cta-item a.video-cta-href { margin-top: 0px; min-width: 68px; }`,null),c.styleInjected=!0}renderCTAButton(t,e){const a=this.rbox.ctaData;if(!a||!a.hasCTAItem)return;if(!this.ctaData.shouldRenderAsCTA&&!a.shouldAdjustAllItemsHeight)return;const n=this.itemContainer.querySelector(".video-label-box");if(!n)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"no_videoLabelBox_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});if(this.itemContainer.rbox.container.querySelector(".story-widget"))return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"item_in_reco_reel_story_widget_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});const i=n.querySelector(".branding");if(i&&this.ctaData.shouldRenderAsCTA&&this.ctaData.isPriceRating&&this.renderPriceRatingSection(n,i),a.shouldAdjustAllItemsHeight&&(t.maxDesiredHeight=Math.max(t.maxDesiredHeight,TRC.CTAManager.getDesiredVideoBoxHeight(n,i,this.ctaData,this.rbox))),!i)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"no_branding_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});const r=i.getBoundingClientRect();if(r&&r.width>0){const t=parseFloat(TRC.CTAManager.getComputedStyleProp(i,"margin-left",0))/r.width;if(t>o)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"high_margin_left_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});const e=parseFloat(TRC.CTAManager.getComputedStyleProp(i,"margin-right",0))/r.width;if(e>o)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"high_margin_right_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});if(TRC.ctaManager.shouldReport){this.ctaData.brandingHeightBefore=r.height;const t=n.getBoundingClientRect();if(t){if(!window.TRCImpl.direction||"ltr"===window.TRCImpl.direction){const e=(r.left-t.left)/t.width;e<.15&&(this.ctaData.brandingDirection="ltr",this.ctaData.brandingLocation=e)}if("rtl"===window.TRCImpl.direction){const e=(t.right-r.right)/t.width;e<.15&&(this.ctaData.brandingDirection="rtl",this.ctaData.brandingLocation=e)}}}}const d=TRC.CTAManager.getComputedStyleProp(n,"height"),g=TRC.CTAManager.getComputedStyleProp(n,"max-height");if(t.maxDesiredHeight>g)TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"videoLabelBox_smaller_than_max_height_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});else{if(d){const t=TRC.CTAManager.getVideoLabelBoxChildrenWithoutButtonHeight(n);if(d+s<t)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"videoLabelBox_smaller_than_children_list_suffix",type:TRC.CTAManager.sendEventTypes.filter})}if(this.ctaData.shouldRenderAsCTA){const a=TRC.CTAManager.getComputedStyleProp(i,"position");if(a&&"absolute"===a)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"branding_absolute_position_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});const r=i.querySelector("div.logoDiv");if(r){const t=TRC.CTAManager.getComputedStyleProp(r,"position");if(t&&"absolute"===t)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"branding_logo_div_inner_absolute_position_list_suffix",type:TRC.CTAManager.sendEventTypes.filter})}const o=this.getMaxWidthForBranding(n,i)||0,s=this.getBrandingWidth(i);if(s>=o)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"large_branding_width_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});const d=c.getBrandingPartsWidth(i)||0;if(d>=o)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"large_branding_parts_width_list_suffix",type:TRC.CTAManager.sendEventTypes.filter});const g=TRC.CTAManager.getComputedStyleProp(n,"boxSizing",null);if(!g||"border-box"!==g){const t=n.getBoundingClientRect();if(t&&t.width>0){const e=parseFloat(TRC.CTAManager.getComputedStyleProp(n,"width",0))/t.width;if(e>l){const t=TRC.CTAManager.getComputedStyleProp(n,"paddingLeft",0),e=TRC.CTAManager.getComputedStyleProp(n,"paddingRight",0);if(t>0||e>0)return void TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"padding_on_full_width_list_suffix",type:TRC.CTAManager.sendEventTypes.filter})}}}t.shouldAdjustHeight=!0,this.drawCTAButton(n,i),n.classList.contains("video-label-box-cta")&&this.handleCtaResponsiveStyle(e)}}}drawCTAButton(t,e){if(TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"rendered"}),TRC.ctaManager.shouldReportAppInstall&&"true"===this.itemContainer.video_data["is-app-install"]){const t="app_install-event-";TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"cta_rendered",eventNamePrefix:t,force:!0}),this.itemContainer.video_data["is-app-install-branding-rendered"]&&TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"label_box_and_cta_rendered",eventNamePrefix:t,force:!0})}const a=this.createCtaAnchorElement(e);this.addCtaToDom(a,t,e),this.addClickMetricToCTA(a.ctaButton),this.ctaData.renderedCtaButton=!0}createCtaAnchorElement(t){const{itemContainer:e,ctaData:a}=this,n=TRC.dom.createHTMLElement("a"),i=this.createCtaButton(t);return n.classList.add("video-cta-href"),"true"===e.video_data["is-app-install"]&&n.classList.add("app-install-size"),n.target="_blank",n.rel="nofollow noopener",n.href=this.createAnchorHref(),n.ctaButton=i,c.setCtaButtonStyle(e,a,i),n.appendChild(i),n}createCtaButton(t){const e=TRC.dom.createHTMLElement("button");return e.type="button",e.classList.add("video-cta-button","video-cta-style"),"true"===this.itemContainer.video_data["is-app-install"]&&e.classList.add("app-install-button"),e.innerText=this.ctaData.actionText,c.setStyleFromElement(t,e,"color"),c.setStyleFromElement(t,e,"font-family"),e}createAnchorHref(){return`${this.itemContainer.link.logger_url}&cta=true`}addCtaToDom(t,e,a){const{itemContainer:n}=this,i=this.isLinkDirectsToLabelLink(n)?n.link:this.getLabelLink();i&&i.classList.add("video-cta-style"),!n.rbox.isFeedCard&&i&&i.classList.add("non-feed-cta-item"),e.classList.add("video-label-box-cta"),"true"===this.itemContainer.video_data["is-app-install"]&&e.classList.add("app-install-full-grid"),!TRC.Browser.ie&&e.classList.add("video-label-box-cta-non-ie");const r=e.querySelectorAll(".video-label");if(r)for(let o=0;o<r.length;o++){const t=r[o];t.classList.add("video-label-flex-cta-item")}this.updateBrandingStyling(t,a),e.appendChild(t)}addClickMetricToCTA(t){const{itemContainer:e,ctaData:a}=this;t.onclick=function(){TRC.ctaManager.sendEvent({itemContainer:e,ctaData:a,name:"cta_button_clicked"})}}isLinkDirectsToLabelLink(t){const e=this.getLabelLink();return!e||!t.link||t.link===e}getLabelLink(){return this.itemContainer.querySelector(".item-label-href")}handleBrandingFlexItemOrder(t,e){if(t.classList.add("video-branding-flex-cta-item"),this.rbox.ctaData.isStream){const a=TRC.CTAManager.getComputedStyleProp(t,"margin-top");a?e.style.marginTop=`${a+1}px`:t.classList.add("video-branding-flex-cta-item-no-stream")}else t.classList.add("video-branding-flex-cta-item-no-stream");t.style.order=1}static setCtaButtonStyle(t,e,a){if(Object.keys(TRC.ctaManager.options.style).forEach(t=>{TRC.ctaManager.options.style[t]&&(a.style[t]=TRC.ctaManager.options.style[t])}),!TRC.ctaManager.options.isInheritTitleColor)return;const n=t.querySelector(".video-title"),i=TRC.CTAManager.getComputedStyleProp(n,"color");i.indexOf("rgb(0, 0, 0)")<0&&TRC.ctaManager.sendEvent({itemContainer:t,ctaData:e,name:"CTA_Title_Not_Black"}),c.setStyleFromElement(n,a,"color"),c.setStyleFromElement(n,a,"border-color")}static setStyleFromElement(t,e,a){if(!e||!t)return;const n=TRC.CTAManager.getComputedStyleProp(t,a);n&&(e.style[a]=n)}static getBrandingPartsWidth(t){const e=t.querySelector(".branding-inner"),a=t.querySelector(".branding-separator"),n=t.querySelector(".logoDiv"),i=e&&TRC.dom.getOuterWidth(e)||0,r=a&&TRC.dom.getOuterWidth(a)||0,o=n&&TRC.dom.getOuterWidth(n)||0;return i+r+o}updateBrandingStyling(t,e){e&&this.handleBrandingFlexItemOrder(e,t)}renderPriceRatingSection(t,e){TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"renderedPriceRating"});const a=this.createPriceRatingSection();a&&t.insertBefore(a,e)}createPriceRatingSection(){if("true"===this.itemContainer.video_data["is-app-install"])return null;const t=TRC.dom.createHTMLElement("span");t.classList.add("video-branding-flex-cta-rating");const e=TRC.dom.createHTMLElement("tbl-star-rating");return e.constructor.isAvailable?(e.setAttribute("separated-by","oval"),this.ctaData.price&&e.setAttribute("price",this.ctaData.price),this.ctaData.rating&&e.setAttribute("rating",this.ctaData.rating),e):t}getBrandingWidth(t){const e=TRC.CTAManager.getComputedStyleProp(t,"font-weight"),a=TRC.CTAManager.getComputedStyleProp(t,"font-size"),n=TRC.CTAManager.getComputedStyleProp(t,"font-family"),i=this.getPseudoElWidth(t,":before"),r=this.getPseudoElWidth(t,":after"),o=this.measureText(this.itemContainer.video_data["branding-text"],e,a,n)||0;return i+o+r}getPseudoElWidth(t,e){let a=0;const n=window.getComputedStyle(t,e,this.itemContainer),i=n&&"none"!==n.content;return i&&(TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"has_pseudo_el"}),a=this.calcPseudoElWidth(n)),a}calcPseudoElWidth(t){let e=parseInt(t.width,10);const a=t.content;return isNaN(e)&&a.length>0&&(e=this.measureText(a,t.fontWeight,t.fontSize,t.fontFamily),TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"has_text_pseudo_el"})),e}getMaxWidthForBranding(t,o){const s=TRC.CTAManager.getComputedStyleProp(this.getEffectiveTitleElement(t),"width"),l=TRC.ctaManager.options.style.fontWeight||"400",d=this.measureText(this.ctaData.actionText,l,r,TRC.CTAManager.getComputedStyleProp(o,"font-family"))||0,c=Math.max(e,d);return s-c-a-n-i}measureText(t,e,a,n){try{if(null==t||""===t)return null;if(null==a&&(null==n||""===n))return null;if(null==d)return TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"measureText_no_canvas"}),null;const i=d.getContext("2d");if(null==i)return TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"measureText_no_canvas_context"}),null;const r=[];if(null!=e&&r.push(e.toString()),null!=a&&r.push(`${parseInt(a,10)}px`),null!=n&&r.push(n),0===r.length)return TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"measureText_no_font_parts"}),null;const o=r.join(" ");if(null==o||""===o)return TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"measureText_empty_font_value"}),null;i.font=o;const s=i.measureText(t);return null==s?(TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"measureText_no_metrics"}),null):s.width}catch(t){return TRC.ctaManager.sendEvent({itemContainer:this.itemContainer,ctaData:this.ctaData,name:"error_measure_text_list_suffix",type:TRC.CTAManager.sendEventTypes.filter}),null}}getEffectiveTitleElement(t){return this.rbox.ctaData.isStream&&t.querySelector(".video-label")||t}handleCtaResponsiveStyle(t){const{itemContainer:e}=this;if(t.fixResponsiveBoxTitleAndDesc(e),"true"!==this.itemContainer.video_data["is-app-install"]&&window.TRC.dom.on(window,"resize",()=>{t.fixResponsiveBoxTitleAndDesc(e)}),e.video_data){const a=t.getDetailSpansFromLabelsBoxes("branding",e);a.length&&setTimeout(()=>{for(let n=0;n<a.length;n++)t.fixBoxOverflow(a[n],e.video_data["branding-text"],!0,!0)},0)}}static areRectsIntersect(t,e,a,n){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect();return 0===i.width||0===i.height||0===r.width||0===r.height?null:i.left>r.right||i.right<r.left||i.top>r.bottom||i.bottom<r.top?null:`${a}_intersects_with_${n}`}static isLocationChanged(t,e,a,n,i,r){if(null==i||!r)return null;const o=t.getBoundingClientRect(),s=e.getBoundingClientRect();if(o&&s){if("ltr"===r){const t=(o.left-s.left)/s.width;if(t>i+.1)return`${a}_moved_from_left`}if("rtl"===r){const t=(s.right-o.right)/s.width;if(t>i+.1)return`${a}_moved_from_right`}}return null}static isElementLargerByDelta(t,e,a,n,i){const r=TRC.CTAManager.getHeightOfElementIncludeMargin(t),o=TRC.CTAManager.getHeightOfElementIncludeMargin(e);return r-o>i?`${a}_is_larger_by_${i}_than_${n}`:null}static isLargeElement(t,e,a,n){const i=t.getBoundingClientRect();return i.height>a?`${e}_${n}_large`:null}static isElementExists(t,e){return t?null:`${e}_not_exists`}static isElementVisible(t,e){return"none"===TRC.CTAManager.getComputedStyleProp(t,"display","unknown")?`${e}_display_none`:null}static isAboveOrBelow(t,e,a,n){const i=t.getBoundingClientRect(),r=e.getBoundingClientRect();return i.top>r.bottom?`${a}_below_${n}`:i.bottom<r.top?`${a}_above_${n}`:null}static isRectNotFullyContainedInRect(t,e,a,n){const i=c.isAboveOrBelow(t,e,a,n);if(i)return i;const r=t.getBoundingClientRect(),o=e.getBoundingClientRect();return r.left<o.left?`${a}_left_border_outside_of_${n}`:r.right>o.right?`${a}_right_border_outside_of_${n}`:r.bottom>o.bottom?`${a}_bottom_border_outside_of_${n}`:r.top<o.top?`${a}_top_border_outside_of_${n}`:null}reportBack(t,e){if(!TRC.ctaManager.shouldReport)return;if(!e.renderedCtaButton)return;const a={alreadyReported:!1,itemContainer:t,ctaData:e};window.TRC.dom.on(window,"scroll",()=>{this.reportOnScroll(a)})}reportOnScroll(t={alreadyReported:!1}){if(t.alreadyReported||!t.itemContainer||!t.ctaData)return;const{itemContainer:e,ctaData:a}=t;try{if(!this.rbox.isInViewPort(e,0))return;if(t.alreadyReported)return;t.alreadyReported=!0,setTimeout(()=>{c.reportOnScrollAfterTimeout(t)},Object.prototype.hasOwnProperty.call(t,"timeout")?t.timeout:3e3)}catch(t){TRC.ctaManager.sendEvent({itemContainer:e,ctaData:a,name:"error_reporting",type:TRC.CTAManager.sendEventTypes.report,description:t.message})}}static reportOnScrollAfterTimeout(t){if(!t.itemContainer||!t.ctaData)return;const{itemContainer:e,ctaData:a}=t;try{TRC.ctaManager.sendEvent({itemContainer:e,ctaData:a,name:"visible",type:TRC.CTAManager.sendEventTypes.report});const t=e.querySelector(".video-label-box"),n=t?t.querySelector(".video-cta-href"):null,i=n?n.querySelector(".video-cta-button"):null,r=t?t.querySelector(".branding"):null,o=c.isElementExists(t,"videoLabelBox")||c.isElementExists(n,"ctaAnchor")||c.isElementExists(i,"ctaButton")||c.isElementExists(r,"branding")||c.isElementVisible(n,"ctaAnchor")||c.isElementVisible(i,"ctaButton")||c.isRectNotFullyContainedInRect(n,e,"ctaAnchor","videoCube")||c.isRectNotFullyContainedInRect(n,t,"ctaAnchor","videoLabelBox")||c.isRectNotFullyContainedInRect(i,n,"ctaButton","ctaAnchor")||c.isAboveOrBelow(n,r,"ctaAnchor","branding")||c.areRectsIntersect(n,r,"ctaAnchor","branding")||c.isLargeElement(i,"ctaButton",TRC.CTAManager.getButtonInnerHeight()+5,"too")||c.isLargeElement(n,"ctaAnchor",TRC.CTAManager.getButtonInnerHeight()+5,"too")||c.isLocationChanged(r,t,"branding","videoLabelBox",a.brandingLocation,a.brandingDirection)||c.isElementLargerByDelta(n,r,"ctaAnchor","branding",20)||c.isElementLargerByDelta(r,n,"branding","ctaAnchor",20)||c.isElementLargerByDelta(n,r,"ctaAnchor","branding",4)||c.isElementLargerByDelta(r,n,"branding","ctaAnchor",4)||c.isLargeElement(r,"branding",1.9*a.brandingHeightBefore,"became");o&&TRC.ctaManager.sendEvent({itemContainer:e,ctaData:a,name:o,type:TRC.CTAManager.sendEventTypes.report})}catch(t){TRC.ctaManager.sendEvent({itemContainer:e,ctaData:a,name:"error_reporting_with_timeout",type:TRC.CTAManager.sendEventTypes.report,description:t.message})}}}TRC.CallToActionComponent=c}();